Sensor processing method of mobile terminal, storage medium, and electronic device

ABSTRACT

A sensor processing method for a mobile terminal, a storage medium, and an electronic device are provided. The sensor processing method includes: detecting whether the mobile terminal is playing a video (S101); when it is detected that the mobile terminal is playing the video, traversing an active connection interface queue for sensors (S102); determining whether an application corresponding to a connection interface in the queue meets a filtering condition (S103); and if not, removing the connection interface from the active connection interface queue (S104).

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation of a U.S. application Ser. No.16/081,468, filed on Aug. 31, 2018, which is a national phase ofInternational Application No. PCT/CN2017/086528, filed on May 31, 2017,which is based on and claims priority of Chinese Patent Application No.201610379895.3, filed on May 31, 2016. The entire contents of theaforementioned applications are incorporated herein by reference.

FIELD

The present disclosure relates to power consumption processingtechnologies, and more particularly to a sensor processing method, astorage medium and an electronic device.

BACKGROUND

At present, an intelligence system has become the operating systemplatform of a smart terminal with greatest user group. Smart terminalshas become the most common and importance electronic devices of manyusers. Various sensors in the smart terminal provide the hardwarebasement for applying diversity functions. However, the sensor providedon the smart terminal may cause power consumption. When a user watchesvideos for a long while, there are still many applications reservingsensors, which may cause additional power consumption of the smartterminal, thereby preventing the smart terminal from improving lifecycle of the battery.

DISCLOSURE

Embodiments of the present disclosure provide a sensor processing methodfor a mobile terminal, a storage medium and an electronic device.

Embodiments of the present disclosure provide a sensor processing methodfor a mobile terminal. The sensor processing method includes: detectingwhether the mobile terminal is playing a video; traversing an activeconnection interface queue for sensors in response to detecting that themobile terminal is playing the video; determining whether an applicationcorresponding to a connection interface in the active connectioninterface queue satisfies a filtering condition, in which the filteringcondition comprises the application not releasing a sensor connectionwhen the mobile terminal is playing the video; and in response todetermining that the application corresponding to the connectioninterface fails to satisfy the filtering condition, removing theconnection interface from the active connection interface queue torelease the sensor connection corresponding to the connection interface.

Embodiments of the present disclosure provide a non-transitory storagemedium. The storage medium has a plurality of instructions storedtherein. The instructions are adapt to be loaded by a processor toperform: detecting whether the mobile terminal is playing a video;traversing an active connection interface queue for sensors in responseto detecting that the mobile terminal is playing the video; determiningwhether an application corresponding to a connection interface in theactive connection interface queue satisfies a filtering condition, inwhich the filtering condition comprises the application not releasing asensor connection when the mobile terminal is playing the video; and inresponse to determining that the application corresponding to theconnection interface fails to satisfy the filtering condition, removingthe connection interface from the active connection interface queue torelease the sensor connection corresponding to the connection interface.

Embodiments of the present disclosure provide an electronic device. Theelectronic device includes a processor and a memory. The memory has aplurality of instructions stored therein. The processor loads theinstructions in the memory to perform: detecting whether the mobileterminal is playing a video; traversing an active connection interfacequeue for sensors in response to detecting that the mobile terminal isplaying the video; determining whether an application corresponding to aconnection interface in the active connection interface queue satisfiesa filtering condition, in which the filtering condition comprises theapplication not releasing a sensor connection when the mobile terminalis playing the video; and in response to determining that theapplication corresponding to the connection interface fails to satisfythe filtering condition, removing the connection interface from theactive connection interface queue to release the sensor connectioncorresponding to the connection interface.

BRIEF DESCRIPTION OF THE DRAWINGS

These and other aspects and advantages of embodiments of the presentdisclosure will become apparent and more readily appreciated from thefollowing descriptions made with reference to the drawings.

FIG. 1 is a flow chart of a sensor processing method for a mobileterminal according to an embodiment of the present disclosure.

FIG. 2 is a flow chart of a process of releasing a sensor connectionaccording to an embodiment of the present disclosure.

FIG. 3 is a flow chart of a process of restoring a sensor connectionaccording to an embodiment of the present disclosure.

FIG. 4 is a block diagram of a sensor processing apparatus for a mobileterminal according to an embodiment of the present disclosure.

FIG. 5 is a block diagram of functional components in a sensorprocessing apparatus for a mobile terminal according to an embodiment ofthe present disclosure.

FIG. 6 is a schematic diagram of an electronic device according to anembodiment of the present disclosure.

FIG. 7 is a schematic diagram of an electronic device according toanother embodiment of the present disclosure.

EMBODIMENTS OF THE PRESENT DISCLOSURE

Reference will now be made in detail to exemplary embodiments, examplesof which are illustrated in the accompanying drawings, in which the sameor similar reference numbers throughout the drawings represent the sameor similar elements or elements having same or similar functions.Embodiments described below with reference to drawings are merelyexemplary and used for explaining the present disclosure, and should notbe understood as limitation to the present disclosure.

The principle of the present disclosure described by the foregoing wordsdoes not represent a limitation. A person skilled in the art may knowthat the following many steps and operations may also be implemented inhardware. According to the principle of the present disclosure,operation is performed by using many other general or specific-purposeoperations, communications environments or configurations.

An execution subject of embodiments of the present disclosure may be amobile terminal. The mobile terminal includes a mobile phone (or calledas “cell” phone, such as a smart phone), a computer having a mobileterminal such as a tablet computer, and a mobile device built-in aportable, pocket-type, hand-held computer, which can interchangelanguage and/or data via wireless access network, for example, apersonal communication service (PCS) phone, a cordless telephone, asession initiation protocol (SIP) phone, a wireless local loop (WLL)station, a personal digital assistant (PDA) or the like, which is notlimited herein.

Embodiments of the present disclosure provide a sensor processing methodfor a mobile terminal, including: detecting whether the mobile terminalis playing a video; traversing an active connection interface queue forsensors in response to detecting that the mobile terminal is playing thevideo; determining whether an application corresponding to a connectioninterface in the active connection interface queue satisfies a filteringcondition, in which the filtering condition comprises the applicationnot releasing a sensor connection when the mobile terminal is playingthe video; and in response to determining that the applicationcorresponding to the connection interface fails to satisfy the filteringcondition, removing the connection interface from the active connectioninterface queue to release the sensor connection corresponding to theconnection interface.

In an embodiment, after removing the connection interface from theactive connection interface queue to release the sensor connectioncorresponding to the connection interface, the method further comprises:storing the connection interface removed from the active connectioninterface queue into a connection queue to be restored; acquiringconfiguration parameter information of a sensor corresponding to theconnection interface; and adding the configuration parameter informationinto the parameter queue to be restored.

In an embodiment, after adding the configuration parameter informationinto the parameter queue to be restored, the method further comprises:determining whether all of connection interfaces in the activeconnection interface queue are traversed; in response to determiningthat not all of connection interfaces in the active connection interfacequeue are traversed, traversing a next connection interface in theactive connection interface queue.

In an embodiment, after adding the configuration parameter informationinto the parameter queue to be restored, the method further comprises:in response to detecting that the mobile terminal quits playing thevideo, traversing the connection queue to be restored; acquiring theconfiguration parameter information from the parameter queue to berestored; and adding the connection interface corresponding to theconfiguration parameter information back into the active connectioninterface queue according to the configuration parameter information, torestore the sensor connection corresponding to connection interface.

In an embodiment, the method further comprises: in response to detectingthat the mobile terminal is playing the video, determining whether themobile terminal quits playing the video within a predetermined timeperiod; in response to determining that the mobile terminal does notquit playing the video within the predetermined time period, traversingthe active connection interface queue.

In an embodiment, detecting whether the mobile terminal is playing thevideo comprises: detecting whether the mobile terminal reservesSCREEN_BRIGHT_WAKE_LOCK and AudioMix Lock; and in response to detectingthat the mobile terminal reserves SCREEN_BRIGHT_WAKE_LOCK and AudioMixLock simultaneously, determining that the mobile terminal is playing thevideo.

In an embodiment, when determining that the mobile terminal is playingthe video, the method further comprises: determining whether a powerconsumption management function is enabled; and in response todetermining that the power consumption management function is enabled,traversing the active connection interface queue.

In an embodiment, a sensor processing method for a mobile terminal isprovided. Referring to FIG. 1, the sensor processing method isapplicable to the mobile terminal, and includes the followings.

At block S101, it is detected whether the mobile terminal is playing avideo.

Detecting whether the mobile terminal is playing a video includesdetecting whether the mobile terminal reserves SCREEN_BRIGHT_WAKE_LOCKand AudioMix Lock; and in response to detecting that the mobile terminalreserves SCREEN_BRIGHT_WAKE_LOCK and AudioMix Lock simultaneously,determining that the mobile terminal is playing the video.

For example, the mobile terminal has two outstanding features whenplaying the video: reserving SCREEN_BRIGHT_WAKE_LOCK to keep a screenalways bright, and reserving AudioMix Lock to ensure normal playback ofaudio. Therefore, it can actually identify the video playing scenethrough two conditions. In a method of acquiring Wake Lock Internal inthe power manager service, it is determined whether a type ofApplication Lock is SCREEN_BRIGHT_WAKE_LOCK. When the type ofApplication Lock is SCREEN_BRIGHT_WAKE_LOCK, it is determined whetherthe application reserves AudioMix Lock simultaneously, if yes, it can beconsidered that the application is playing the video.

However, it can be understood that, the present disclosure is notlimited to the above determining ways, any variation, equivalentsubstitution and modification that fall within the spirit and principleof the present disclosure should be embraced by the protective scope ofthe present disclosure.

In embodiments of the present disclosure, when the application needs touse a sensor, a connection interface is allocated to the application.Through the connection interface, the application can invoke the sensorto work and add the allocated connection interface to an activeconnection interface queue for the sensors.

In the following, a functional structure for managing sensors will bedescribed in detail.

In Android system of the mobile terminal, the sensor managementframework includes a client, a server, and a hardware abstract layer(HAL). The client encapsulates interfaces of sensors for theapplication. The server manages all sensor data. The HAL encapsulatesdirect access of the server to Kernel. The server reads the sensor datafrom the HAL and writes the sensor data into channel. The client readsserver-side data via the channel.

When the application needs to use the sensor, a system sensor managerinstance of the client is acquired and a listener interface isregistered through the instance. After registering the listenerinterface, the server can provide a sensor event connection interface tothe client. The connection interface is allocated to the application.Through the connection interface, the application can acquire data fromthe sensor through the client.

When the client registers the listener interface, the server may invokean enable interface of the sensor to enable the sensor. When the clientunregisters the listener interface, the server may invoke a disableinterface of the sensor to disable the sensor.

At block S102, in response to detecting that the mobile terminal isplaying the video, the active connection interface queue is traversed.

In an embodiment of the present disclosure, after detecting that themobile terminal is playing the video, the method further includes: inresponse to detecting that the mobile terminal is playing the video,determining whether a power consumption function is enabled; and inresponse to determining that the power consumption management functionis enabled, traversing the active connection interface queue. In anembodiment, an interface having an enable interface and a disableinterface of the power consumption function is provided, when a userclicks the enable interface, the power consumption function can beenabled automatically, and when the user clicks the disable interface,the power consumption function can be disabled automatically.

The active connection interface queue mActiveConnections for the sensorsis configured to store current active sensor connections. When theenable interface is invoked, a newly registered connection interface isadded to the active connection interface queue mActiveConnections forthe sensors. When the disable interface is invoked, a correspondingconnection interface is removed from the active connection interfacequeue mActiveConnections for the sensors.

In order to decrease occurrence of misjudging whether the mobileterminal is playing the video, when detecting that the mobile terminalis playing the video, it is further determined whether the mobileterminal quits playing the video within a predetermined time period; inresponse to detecting that the mobile terminal does not quit playing thevideo within the predetermined time period, traversing the activeconnection interface queue.

At block S103, it is determined whether an application corresponding toa connection interface in the active connection interface queuesatisfies a filtering condition. The filtering condition comprises theapplication not releasing a sensor connection when the mobile terminalis playing the video.

The power consumption management application has a mechanism todetermine whether the application is allowed to reserve a sensor whenthe video is played (i.e., the above-mentioned filtering condition). Forexample, applications such as movement-type applications,navigation-type applications, and system built-in applications areallowed to reserve the sensor when the video is played, while otherapplications are forbidden to reserve the sensor when the video isplayed. Therefore, if an application is allowed to reserve a sensor whenthe video is played, the application is filtered out in block S103.Applications which are not filtered out in block S103 will performcorresponding operations in block S104.

However, in an embodiment, a list recording applications which areallowed to reserve the sensor when the video is played may be generatedby a security module of the mobile terminal, or may be selected by theuser, or may be pushed by a cloud server.

In embodiments of the present disclosure, the list recordingapplications which are allowed to reserve the sensor when the video isplayed may be stored at the mobile terminal side in a form of document,or may be stored at the mobile terminal side in a form of database, ormay be stored on the basis of cloud server.

In the case that the list is stored in a form of document or database,after the mobile terminal enables the power consumption managementfunction, the list recording applications which are allowed to reservethe sensor when the video is played that stored at the mobile terminalside in advance can be invoked from the mobile terminal side.

In the case that the list is stored on the basis of cloud server, afterthe mobile terminal enables the power consumption management function,the mobile terminal is triggered to read the list recording applicationswhich are allowed to reserve the sensor when the video is played fromthe color server.

At block S104, in response to determining that the applicationcorresponding to the connection interface fails to satisfy the filteringcondition, the connection interface is removed from the activeconnection interface queue to release a sensor connection correspondingto the connection interface.

For example, the system of the mobile terminal adds a method ofreleasing and saving the sensor connection (i.e., release And SaveSensor) in the sensor service of native layer. This method traverses theactive connection interface queue mActiveConnections, if a connectioninterface fails to satisfy the filtering condition of the filteringmechanism, a disable method is invoked to release the sensor connection.The connection interface is removed from the active connection interfacequeue, meanwhile the connection interface is stored in a connectionqueue to be restored mSavedConnections, the configuration parameter ofthe sensor corresponding to the connection interface is added in aparameter queue to be restored mSavedParams, such that the sensorconnection can be restored after the mobile terminal quits playing thevideo.

In embodiments of the present disclosure, when the mobile terminal quitsplaying the video, the sensor connection can be automatically restoredas follows.

1. After the connection interface is removed from the active connectioninterface queue to release the sensor connection corresponding to theconnection interface, the connection interface removed from the activeconnection interface queue is stored in the connection queue to berestored.

2. The configuration parameter information of the sensor correspondingto the removed connection interface is acquired.

3. The configuration parameter information of the sensor is added intothe parameter queue to be restored.

4. In response to detecting that the mobile terminal quits playing thevideo, the connection queue to be restored is traversed.

5. The configuration parameter information of the sensor is acquiredfrom the parameter queue to be restored.

6. The corresponding connection interface is added into the activeconnection interface queue again according to the configurationparameter information of the sensor, to restore the corresponding sensorconnection.

For example, the system of the mobile terminal adds a method ofrestoring the sensor connection, i.e., restore Sensor, into the systemservice Sensor Service of the native layer. The restore Sensor methodtraverses the connection queue to be restored mSavedConnections, thecorresponding sensor configuration parameter is acquired from theparameter queue to be restored mSavedParams, and an enable method isinvoked to restore the corresponding sensor connection, meanwhile theconnection interface is added into the active connection interface queuemActiveConnections again.

With the sensor processing method for a mobile terminal according toembodiments of the present disclosure, it is detected whether the mobileterminal is playing the video. The active connection interface queue forthe sensor is traversed in response to detecting that the mobileterminal is playing the video. It is determined whether an applicationcorresponding to a connection interface in the active connectioninterface queue satisfies the filtering condition, the filteringcondition including the application not releasing a sensor connectionwhen the mobile terminal is playing the video. In response to detectingthat the application corresponding to the connection interface fails tosatisfy the filtering condition, the connection interface is removedfrom the active connection interface queue to release the sensorconnection corresponding to the connection interface. In the presentdisclosure, the sensor connection satisfying predetermined requirementscan be released automatically when the video is played, and the sensorconnection is restored when the mobile terminal quits playing the video.In this way, the power consumption of the mobile terminal can be reducedeffectively, thereby improving the life cycle of the mobile terminal.

In an embodiment, referring to FIG. 2, a process of releasing a sensorconnection according to an embodiment of the present disclosure isillustrated.

The process of releasing the sensor connection is applicable to a mobileterminal and includes the followings.

At block S201, it is detected whether the mobile terminal is playing avideo (i.e., whether to enter playing of the video).

At block S202, in response to detecting that the video is played, it isfurther determined whether a power consumption management function isenabled.

At block S203, in response to determining that the power consumptionmanagement function is enabled, an active connection interface queuemActiveConnections for sensors is traversed.

At block S204, it is determined whether an application corresponding toa connection interface in the active connection interface queuesatisfies a filtering condition. The filtering condition includes theapplication not releasing the sensor connection when the mobile terminalis playing the video.

The power consumption management application stores a mechanism todetermine whether an application is allowed to reserve a sensor when thevideo is played (i.e., the above-mentioned filtering condition).Applications such as movement-type applications, navigation-typeapplications, system built-in applications are allowed to reserve thesensor when the video is played. Other applications are forbidden toreserve the sensor when the video is played.

In this block, for example, in response to determining the applicationcorresponding to a connection interface in the active connectioninterface queue is not one of the movement-type applications, thenavigation-type applications and the system built-in applications, itcan determine that the application corresponding to the connectioninterface fails to satisfy the filtering condition. Thus, the sensorconnection needs to be released.

At block S205, in response to determining that the applicationcorresponding to the connection interface fails to satisfy the filteringcondition, the disable method is invoked to release the sensorconnection, and the connection interface is removed from the activeconnection interface queue.

At block S206, the connection interface removed from the activeconnection interface queue is added into a connection queue to berestored mSavedConnections.

At block S207, configuration parameter information of the sensor isadded into a parameter queue to be restored mSavedParams.

At block S208, it is determined whether all of connection interfaces inthe active connection interface queue mActiveConnections are traversed.

At block S209, in response to determining that all of connectioninterfaces in the active connection interface queue mActiveConnectionsare traversed, this process is ended. In response to determining thatnot all of connection interfaces in the active connection interfacequeue mActiveConnections are traversed, an act of block S203 is executedto traverse a nest connection interface in the active connectioninterface queue mActiveConnections.

In an embodiment, referring to FIG. 3, a process of restoring a sensorconnection according to an embodiment of the present disclosure isillustrated.

The process of restoring the sensor connection is applicable to a mobileterminal and includes the followings.

At block S301, the mobile phone detects whether to quit playing thevideo automatically.

At block S302, in response to detecting that the mobile phone quitsplaying the video, the connection queue to be restored mSavedConnectionsis traversed.

At block S303, the configuration parameter information of the sensor isacquired from the parameter queue to be stored mSavedConnections.

At block S304, the enable method is invoked to restore the correspondingsensor connection, meanwhile the connection interface is added into theactive connection interface queue mActiveConnections again.

At block S305, it is determined whether all of connection interfaces inthe connection queue to be stored mSavedConnections are traversed.

At block S306, in response to determining that all of connectioninterfaces in the connection queue to be stored mSavedConnections aretraversed, this process is ended. In response to determining that notall of connection interfaces in the connection queue to be storedmSavedConnections are traversed, the act in block S302 is executed totraverse a next connection interface of the connection queue to bestored mSavedConnections.

With the sensor processing method for the mobile terminal, it isdetected whether the mobile terminal is playing the video. In responseto detecting that the mobile terminal is playing the video, the activeconnection interface queue for the sensors is traversed. It isdetermined whether an application corresponding to a connectioninterface in the active connection interface queue satisfies thefiltering condition, the filtering condition including the applicationnot releasing a sensor connection when the mobile terminal is playingthe video. In response to detecting that the application correspondingto the connection interface fails to satisfy the filtering condition,the connection interface is removed from the active connection interfacequeue to release the sensor connection corresponding to the connectioninterface. In the present disclosure, the sensor connection satisfyingpredetermined requirements can be released automatically when the videois played, and the sensor connection is restored when the mobileterminal quits playing the video. In this way, the power consumption ofthe mobile terminal can be reduced effectively, thereby improving thelife cycle of the mobile terminal.

The embodiments of the present disclosure provide a sensor processingapparatus for a mobile terminal. The sensor processing apparatus for themobile terminal includes a video detecting module, a first traversingmodule, a filter determining module and a removing module.

The video detecting module is configured to detect whether the mobileterminal is playing a video.

The first filtering module is configured to traverse an activeconnection interface queue for sensors in response to detecting that themobile terminal is playing the video.

The filter determining module is configured to determine whether anapplication corresponding to a connection interface in the activeconnection interface queue satisfies a filtering condition, in which thefiltering condition comprises the application not releasing a sensorconnection when the mobile terminal is playing the video.

The removing module is configured to, in response to determining thatthe application corresponding to the connection interface fails tosatisfy the filtering condition, remove the connection interface fromthe active connection interface queue to release the sensor connectioncorresponding to the connection interface.

In an embodiment, the sensor processing apparatus further includes astoring module, a first parameter acquiring module, and a parameteradding module.

The storing module is configured to store the connection interfaceremoved from the active connection interface queue into a connectionqueue to be restored.

The first parameter acquiring module is configured to acquireconfiguration parameter information of a sensor corresponding to theconnection interface; and

The parameter adding module is configured to add the configurationparameter information into the parameter queue to be restored.

In an embodiment, the sensor processing apparatus further includes asecond traversing module, a second parameter acquiring module, and aninterface adding module.

The second traversing module is configured to, in response to detectingthat the mobile terminal quits playing the video, traverse theconnection queue to be restored.

The second parameter acquiring module is configured to acquire theconfiguration parameter information from the parameter queue to berestored.

The interface adding module is configured to add the connectioninterface corresponding to the configuration parameter information backinto the active connection interface queue according to theconfiguration parameter information, to restore the sensor connectioncorresponding to connection interface.

In an embodiment, the sensor processing apparatus further includes atime determining module configured to, in response to detecting that themobile terminal is playing the video, determine whether the mobileterminal quits playing the video within a predetermined time period. Thefirst traversing module is configured to, in response to determiningthat the mobile terminal does not quit playing the video within thepredetermined time period, traverse the active connection interfacequeue.

In an embodiment, the video detecting module includes a lock detectingmodule and a determining module.

The lock detecting module is configured to detect whether the mobileterminal reserves SCREEN_BRIGHT_WAKE_LOCK and AudioMix Lock.

The determining module is configured to, in response to detecting thatthe mobile terminal reserves SCREEN_BRIGHT_WAKE_LOCK and AudioMix Locksimultaneously, determine that the mobile terminal is playing the video.

In an embodiment, the first traversing module is configured to determinewhether a power consumption management function is enabled in responseto detecting that the mobile terminal is playing the video, and inresponse to determining that the power consumption management functionis enabled, traverse the active connection interface queue.

In an embodiment, referring to FIG. 4 together with FIG. 5, componentsof the sensor processing apparatus for the mobile terminal according toembodiments of the present disclosure are illustrated. For ease ofdescription, only related components are illustrated. The sensorprocessing apparatus for the mobile terminal includes a video detectingmodule 101, a first traversing module 102, a filter determining module103 and a removing module 104. The sensor processing apparatus for themobile terminal may be a software unit, a hardware unit or a unit incombination with software and hardware built in the mobile terminal.

The video detecting module 101 is configured to detect whether themobile terminal is playing a video.

Detecting whether the mobile terminal is playing a video comprises:detecting whether the mobile terminal reserves SCREEN_BRIGHT_WAKE_LOCKand AudioMix Lock; and in response to detecting that the mobile terminalreserves SCREEN_BRIGHT_WAKE_LOCK and AudioMix Lock simultaneously,determining that the mobile terminal is playing the video.

For example, the mobile terminal has two outstanding features whenplaying the video: reserving SCREEN_BRIGHT_WAKE_LOCK to keep a screenalways bright, and reserving AudioMix Lock to ensure normal playback ofaudio. Therefore, it can actually identify the video playing scenethrough two conditions. In a method of acquiring Wake Lock Internal inthe power manager service, it is determined whether a type ofApplication Lock is SCREEN_BRIGHT_WAKE_LOCK. When the type ofApplication Lock is SCREEN_BRIGHT_WAKE_LOCK, it is determined whetherthe application reserves AudioMix Lock simultaneously, if yes, it can beconsidered that the application is playing the video.

However, it can be understood that, the present disclosure is notlimited to the above determining ways, any variation, equivalentsubstitution and modification that fall within the spirit and principleof the present disclosure should be embraced by the protective scope ofthe present disclosure.

The first filtering module 102 is configured to traverse an activeconnection interface queue for sensors in response to detecting that themobile terminal is playing the video.

The filter determining module 103 is configured to determine whether anapplication corresponding to a connection interface in the activeconnection interface queue satisfies a filtering condition, in which thefiltering condition comprises the application not releasing a sensorconnection when the mobile terminal is playing the video.

The power consumption management application has a mechanism todetermine whether the application is allowed to reserve a sensor whenthe video is played (i.e., the above-mentioned filtering condition). Forexample, applications such as movement-type applications,navigation-type applications, and system built-in applications areallowed to reserve the sensor when the video is played, while otherapplications are forbidden to reserve the sensor when the video isplayed.

The removing module 104 is configured to, in response to determiningthat the application corresponding to the connection interface fails tosatisfy the filtering condition, remove the connection interface fromthe active connection interface queue to release the sensor connectioncorresponding to the connection interface.

Further, the sensor processing apparatus further includes a storingmodule 105, a first parameter acquiring module 106, and a parameteradding module 107.

The storing module 105 is configured to store the connection interfaceremoved from the active connection interface queue into a connectionqueue to be restored.

The first parameter acquiring module 106 is configured to acquireconfiguration parameter information of a sensor corresponding to theconnection interface; and

The parameter adding module 107 is configured to add the configurationparameter information into the parameter queue to be restored.

Further, the sensor processing apparatus further includes a secondtraversing module 108, a second parameter acquiring module 109, and aninterface adding module 110.

The second traversing module 108 is configured to, in response todetecting that the mobile terminal quits playing the video, traverse theconnection queue to be restored.

The second parameter acquiring module 109 is configured to acquire theconfiguration parameter information from the parameter queue to berestored.

The interface adding module 110 is configured to add the connectioninterface corresponding to the configuration parameter information backinto the active connection interface queue according to theconfiguration parameter information, to restore the sensor connectioncorresponding to connection interface.

Further, the sensor processing apparatus further includes a timedetermining module 111 configured to, in response to detecting that themobile terminal is playing the video, determine whether the mobileterminal quits playing the video within a predetermined time period.

The first traversing module 102 is configured to, in response todetermining that the mobile terminal does not quit playing the videowithin the predetermined time period, traverse the active connectioninterface queue.

Further, the video detecting module includes a lock detecting module anda determining module.

The lock detecting module is configured to detect whether the mobileterminal reserves SCREEN_BRIGHT_WAKE_LOCK and AudioMix Lock.

The determining module is configured to, in response to detecting thatthe mobile terminal reserves SCREEN_BRIGHT_WAKE_LOCK and AudioMix Locksimultaneously, determine that the mobile terminal is playing the video.

In practical, the above-mentioned respective modules may be implementedas separated entities or may be combined in any way, for example,implemented as the same or several entities. The embodiments of theabove-mentioned respective modules may refer to the method embodiments,which is not described herein.

With the sensor processing apparatus for the mobile terminal, it isdetected whether the mobile terminal is playing the video. In responseto detecting that the mobile terminal is playing the video, the activeconnection interface queue for the sensors is traversed. It isdetermined whether an application corresponding to a connectioninterface in the active connection interface queue satisfies thefiltering condition, the filtering condition including the applicationnot releasing a sensor connection when the mobile terminal is playingthe video. In response to detecting that the application correspondingto the connection interface fails to satisfy the filtering condition,the connection interface is removed from the active connection interfacequeue to release the sensor connection corresponding to the connectioninterface. In the present disclosure, the sensor connection satisfyingpredetermined requirements can be released automatically when the videois played, and the sensor connection is restored when the mobileterminal quits playing the video. In this way, the power consumption ofthe mobile terminal can be reduced effectively, thereby improving thelife cycle of the mobile terminal.

In an embodiment, embodiments of the present disclosure further improvea storage medium having a plurality of instructions stored therein. Theplurality of instructions are adapt to be loaded by a processor toperform: detecting whether the mobile terminal is playing a video;traversing an active connection interface queue for sensors in responseto detecting that the mobile terminal is playing the video; determiningwhether an application corresponding to a connection interface in theactive connection interface queue satisfies a filtering condition, inwhich the filtering condition comprises the application not releasing asensor connection when the mobile terminal is playing the video; and inresponse to determining that the application corresponding to theconnection interface fails to satisfy the filtering condition, removingthe connection interface from the active connection interface queue torelease the sensor connection corresponding to the connection interface.

In an embodiment, an electronic device is provided. The electronicdevice may be a smart phone, a tablet computer or the like. Asillustrated in FIG. 6, the electronic device 300 includes a processor301, a memory 302, a display screen 303 and a control circuit 304. Theprocessor 301 is electrically coupled to the memory 302, the displayscreen 303 and the control circuit respectively.

The processor 301 is a control center of the electronic device 300,which can be coupled to respective components of the electronic device300 via various interfaces and wires, and can perform various functionsand processing data of the electronic device by running softwareprograms stored in the memory 302 and invoking data stored in the memory302.

In an embodiment, the processor 301 in the electronic device 300 canload instructions corresponding to one or more processes of applicationin the memory 302 and run the application stored in the memory 302 toimplement various functions by performing: detecting whether the mobileterminal is playing a video; traversing an active connection interfacequeue for sensors in response to detecting that the mobile terminal isplaying the video; determining whether an application corresponding to aconnection interface in the active connection interface queue satisfiesa filtering condition, in which the filtering condition comprises theapplication not releasing a sensor connection when the mobile terminalis playing the video; and in response to determining that theapplication corresponding to the connection interface fails to satisfythe filtering condition, removing the connection interface from theactive connection interface queue to release the sensor connectioncorresponding to the connection interface.

In an embodiment, after removing the connection interface from theactive connection interface queue to release the sensor connectioncorresponding to the connection interface, the processor 301 isconfigured to perform: storing the connection interface removed from theactive connection interface queue into a connection queue to berestored; acquiring configuration parameter information of a sensorcorresponding to the connection interface; and adding the configurationparameter information into a parameter queue to be restored.

In an embodiment, the processor 301 is configured to perform: inresponse to detecting that the mobile terminal quits playing the video,traversing the connection queue to be restored; acquiring theconfiguration parameter information from the parameter queue to berestored; and adding the connection interface corresponding to theconfiguration parameter information back into the active connectioninterface queue according to the configuration parameter information, torestore the sensor connection corresponding to connection interface.

In an embodiment, the processor 301 is configured to perform: inresponse to detecting that the mobile terminal is playing the video,determining whether the mobile terminal quits playing the video within apredetermined time period; in response to determining that the mobileterminal does not quit playing the video within the predetermined timeperiod, traversing the active connection interface queue.

In an embodiment, the processor 301 is configured to perform: detectingwhether the mobile terminal reserves SCREEN_BRIGHT_WAKE_LOCK andAudioMix Lock; and in response to detecting that the mobile terminalreserves SCREEN_BRIGHT_WAKE_LOCK and AudioMix Lock simultaneously,determining that the mobile terminal is playing the video.

In an embodiment, when determining that the mobile terminal is playingthe video, the processor 301 is configured to perform: determiningwhether a power consumption management function is enabled; and inresponse to determining that the power consumption management functionis enabled, traversing the active connection interface queue.

The memory 302 may be configured to store applications and data. Theapplications stored in comprise instructions executable by theprocessor. The applications can compose various functional modules. Theprocessor 301 performs various functional applications and dataprocessing by running the applications stored in the memory 302.

The display screen 303 may be configured to display information inputtedby the user, information provided to the user and various graphic userinterfaces of the terminal. These graphic user interfaces may constituteimages, text, icons, videos or any combination thereof.

The control circuit 304 is electrically coupled to the display screen303, configured to control the display screen 303 to displayinformation.

In some embodiments, as illustrated in FIG. 7, the electronic device 300further includes a radio frequency (RF) circuit 305, an input unit 306,an audio circuit 307, a sensor 308, and a power supply 309. Theprocessor 301 is electrically coupled to the RF circuit 305, the inputcircuit 306, the audio circuit 307, the sensor 308, and the power supply309.

The RF circuit 305 may be configured to receive and send RF signals toestablish wireless communication between network devices or otherelectronic devices via wireless communication mode. The RF circuit 305may be configured to receive and send signals with the network devicesand other electronic devices.

The input unit 306 may be configured to receive input digital orcharacter information, or user characteristic information (such asfingerprint) to generate keypad input, mouse input, joystick input,optical or trackball input related to the user setting and functionalcontrol. The input unit 306 may include a fingerprint identificationcomponent.

The audio circuit 307 may provide audio interfaces between the user andthe terminal through a loudspeaker, and a microphone.

The electronic device 300 may further include at least one sensor 308,such as an optical sensor, a motion sensor and other sensors. Theoptical sensor may include an ambient light sensor and a proximitysensor. The ambient light sensor can adjust luminance of the displaypanel according to brightness of the ambient light. The proximity sensormay switch off the display panel and/or backlight when the terminal ismoved to the ear. As one type of motion sensor, an acceleration sensorcan detect acceleration values in various directions (generally on threeaxes), may detect magnitude and a direction of the gravity when themobile phone is static, and may be applied to an application thatrecognizes the attitude of the mobile phone (for example,landscape/portrait screen switching, a related game, and magnetometerattitude calibration), a function related to vibration recognition (suchas a pedometer and a knocking), and the like. In addition, the terminalcan be configured with other sensors, such as a barometer, a hygrometer,a thermometer, and an infrared sensor, which are not further describedherein.

The power supply 309 is configured for supplying power to the componentsof the electronic device 300. In some embodiments, the power supply 309may be logically coupled with the processor 301 by using a powermanagement system, thereby implementing functions such as charging,discharging and power consumption management by using the powermanagement system.

Although not illustrated in the FIG. 7, the electronic device 300 mayfurther include a camera, a Bluetooth component and the like, which isnot further described herein.

With the electronic device provided by embodiments of the presentdisclosure, it is detected whether the mobile terminal is playing thevideo. In response to detecting that the mobile terminal is playing thevideo, the active connection interface queue for the sensor istraversed. It is determined whether an application corresponding to aconnection interface in the active connection interface queue satisfiesthe filtering condition, the filtering condition including theapplication not releasing a sensor connection when the mobile terminalis playing the video. In response to detecting that the applicationcorresponding to the connection interface fails to satisfy the filteringcondition, the connection interface is removed from the activeconnection interface queue to release the sensor connectioncorresponding to the connection interface. In the present disclosure,the sensor connection satisfying predetermined requirements can bereleased automatically when the video is played, and the sensorconnection is restored when the mobile terminal quits playing the video.In this way, the power consumption of the mobile terminal can be reducedeffectively, thereby improving the life cycle of the mobile terminal.

It should be understood that all or a part of the method provided by thepresent disclosure may be realized by programs instructing relativehardware, the programs may be stored in a computer-readable memory. Thememory may include a read-only memory ROM, a random access memory RAM, amagnet disk, an optical disk and the like.

Although embodiments of present disclosure have been shown and describedabove, it should be understood that above embodiments are justexplanatory, and cannot be construed to limit the present disclosure,for those skilled in the art, changes, alternatives, and modificationscan be made to the embodiments without departing from spirit, principlesand scope of the present disclosure.

What is claimed is:
 1. A sensor processing method for a mobile terminal,comprising: assigning a connection interface to an application when theapplication needs to use sensors, and adding the allocated connectioninterface to an active connection interface queue for the sensors,wherein the active connection interface queue for the sensors isconfigured to store a currently available sensor connection; detectingwhether the mobile terminal is playing a video; traversing the activeconnection interface queue for the sensors in response to detecting thatthe mobile terminal is playing the video; determining whether anapplication corresponding to a connection interface in the activeconnection interface queue satisfies a filtering condition, wherein thefiltering condition comprises the application not releasing a sensorconnection when the mobile terminal is playing the video; and inresponse to determining that the application corresponding to theconnection interface fails to satisfy the filtering condition, invokinga disable interface of the sensor, and removing the connection interfacefrom the active connection interface queue to release the sensorconnection corresponding to the connection interface.
 2. The sensorprocessing method according to claim 1, wherein after removing theconnection interface from the active connection interface queue torelease the sensor connection corresponding to the connection interface,the method further comprises: storing the connection interface removedfrom the active connection interface queue into a connection queue to berestored; acquiring configuration parameter information of a sensorcorresponding to the connection interface; and adding the configurationparameter information into a parameter queue to be restored.
 3. Thesensor processing method according to claim 2, wherein after adding theconfiguration parameter information into the parameter queue to berestored, the method further comprises: determining whether all ofconnection interfaces in the active connection interface queue aretraversed; in response to determining that not all of connectioninterfaces in the active connection interface queue are traversed,traversing a next connection interface in the active connectioninterface queue.
 4. The sensor processing method according to claim 2,wherein after adding the configuration parameter information into theparameter queue to be restored, the method further comprises: inresponse to detecting that the mobile terminal quits playing the video,traversing the connection queue to be restored; acquiring theconfiguration parameter information from the parameter queue to berestored; and adding the connection interface corresponding to theconfiguration parameter information back into the active connectioninterface queue according to the configuration parameter information, torestore the sensor connection corresponding to connection interface. 5.The sensor processing method according to claim 1, further comprising:in response to detecting that the mobile terminal is playing the video,determining whether the mobile terminal quits playing the video within apredetermined time period; in response to determining that the mobileterminal does not quit playing the video within the predetermined timeperiod, traversing the active connection interface queue.
 6. The sensorprocessing method according to claim 1, wherein detecting whether themobile terminal is playing the video comprises: detecting whether themobile terminal reserves SCREEN_BRIGHT_WAKE_LOCK and AudioMix Lock; andin response to detecting that the mobile terminal reservesSCREEN_BRIGHT_WAKE_LOCK and AudioMix Lock simultaneously, determiningthat the mobile terminal is playing the video.
 7. The sensor processingmethod according to claim 1, wherein when determining that the mobileterminal is playing the video, the method further comprises: determiningwhether a power consumption management function is enabled; and inresponse to determining that the power consumption management functionis enabled, traversing the active connection interface queue.
 8. Thesensor processing method according to claim 6, wherein detecting whetherthe mobile terminal reserves SCREEN_BRIGHT_WAKE_LOCK and AudioMix Lockcomprises: detecting whether a type of an application lock isSCREEN_BRIGHT_WAKE_LOCK; and in response detecting that the type of theapplication lock is SCREEN_BRIGHT_WAKE_LOCK, determining whether themobile terminal reserves AudioMix Lock simultaneously.
 9. The sensorprocessing method according to claim 1, wherein determining whether anapplication corresponding to a connection interface in the activeconnection interface queue satisfies a filtering condition comprises:acquiring a list recording applications each allowed to reserve a sensorwhen the mobile terminal is playing the video; determining whether theapplication is in the list; and determining that the applicationsatisfies a filtering condition when the application is in the list. 10.The sensor processing method according to claim 9, wherein the list isstored in the mobile terminal; and acquiring the list recordingapplications each allowed to reserve a sensor when the mobile terminalis playing the video comprises: invoking the list stored in the mobileterminal.
 11. The sensor processing method according to claim 9, whereinthe list is stored in a cloud server; and acquiring the list recordingapplications each allowed to reserve a sensor when the mobile terminalis playing the video comprises: reading the list from the cloud server.12. A sensor processing apparatus for a mobile terminal, comprising: aprocessor and a memory storing instructions executable by the processor,wherein the processor is configured to: assign a connection interface toan application when the application needs to use sensors, and add theallocated connection interface to an active connection interface queuefor the sensors, in which the active connection interface queue for thesensors is configured to store a currently available sensor connection;detect whether the mobile terminal is playing a video; traverse theactive connection interface queue for the sensors in response todetecting that the mobile terminal is playing the video; determinewhether an application corresponding to a connection interface in theactive connection interface queue satisfies a filtering condition, inwhich the filtering condition comprises the application not releasing asensor connection when the mobile terminal is playing the video; and inresponse to determining that the application corresponding to theconnection interface fails to satisfy the filtering condition, invoke adisable interface of the sensor, and remove the connection interfacefrom the active connection interface queue to release the sensorconnection corresponding to the connection interface.
 13. The sensorprocessing apparatus according to claim 12, wherein the processor isfurther configured to: store the connection interface removed from theactive connection interface queue into a connection queue to berestored; acquire configuration parameter information of a sensorcorresponding to the connection interface; and add the configurationparameter information into a parameter queue to be restored.
 14. Thesensor processing apparatus according to claim 13, wherein processor isfurther configured to: determine whether all of connection interfaces inthe active connection interface queue are traversed; in response todetermining that not all of connection interfaces in the activeconnection interface queue are traversed, traverse a next connectioninterface in the active connection interface queue.
 15. The sensorprocessing apparatus according to claim 13, wherein the processor isfurther configured to: in response to detecting that the mobile terminalquits playing the video, traverse the connection queue to be restored;acquire the configuration parameter information from the parameter queueto be restored; and add the connection interface corresponding to theconfiguration parameter information back into the active connectioninterface queue according to the configuration parameter information, torestore the sensor connection corresponding to connection interface. 16.The sensor processing apparatus according to claim 12, wherein theprocessor is further configured to: in response to detecting that themobile terminal is playing the video, determine whether the mobileterminal quits playing the video within a predetermined time period; inresponse to determining that the mobile terminal does not quit playingthe video within the predetermined time period, traverse the activeconnection interface queue.
 17. The sensor processing apparatusaccording to claim 12, wherein the processor is configured to detectwhether the mobile terminal is playing the video by performing acts of:detecting whether the mobile terminal reserves SCREEN_BRIGHT_WAKE_LOCKand AudioMix Lock; and in response to detecting that the mobile terminalreserves SCREEN_BRIGHT_WAKE_LOCK and AudioMix Lock simultaneously,determining that the mobile terminal is playing the video.
 18. Thesensor processing apparatus according to claim 12, wherein whendetermining that the mobile terminal is playing the video, the processoris further configured to: determine whether a power consumptionmanagement function is enabled; and in response to determining that thepower consumption management function is enabled, traverse the activeconnection interface queue.
 19. The sensor processing apparatusaccording to claim 17, wherein the processor is configured to detectwhether the mobile terminal reserves SCREEN_BRIGHT_WAKE_LOCK andAudioMix Lock by performing acts of: detecting whether a type of anapplication lock is SCREEN_BRIGHT_WAKE_LOCK; and in response detectingthat the type of the application lock is SCREEN_BRIGHT_WAKE_LOCK,determining whether the mobile terminal reserves AudioMix Locksimultaneously.
 20. A storage medium, having stored therein a computerprogram, wherein when the computer program is executed on a computer, asensor processing method is performed, and the sensor processing methodcomprises: assigning a connection interface to an application when theapplication needs to use sensors, and adding the allocated connectioninterface to an active connection interface queue for the sensors,wherein the active connection interface queue of the sensor isconfigured to store a currently available sensor connection; detectingwhether the mobile terminal is playing a video; traversing the activeconnection interface queue for the sensors in response to detecting thatthe mobile terminal is playing the video; determining whether anapplication corresponding to a connection interface in the activeconnection interface queue satisfies a filtering condition, wherein thefiltering condition comprises the application not releasing a sensorconnection when the mobile terminal is playing the video; and inresponse to determining that the application corresponding to theconnection interface fails to satisfy the filtering condition, invokinga disable interface of the sensor, and removing the connection interfacefrom the active connection interface queue to release the sensorconnection corresponding to the connection interface.